<@user.user_html> 
    
    <div class="clear"></div>
	

    <div class="swarp">
    	<#-- 嵌入导航-->
		<#include "/WEB-INF/content/include/user/app.ftl">

        <div class="srightwarp">
        	<div class="xwarp" style=" margin:0px; width:750px; overflow:hidden;">
            	<div class="xtitle">
            		<ul>
                    	<li class="check"><a href="${base}/user/music/">音  乐</a></li>
                    </ul>
                    <div class="clear"></div>
                </div>
                <div class="xbody sbody" style=" width:748px; margin:0px; padding:40px 0px;">
                	 <div class="MusicSearch" style="padding-bottom:20px;">
						<form name="saveForm" id="saveForm" action="${base}/user/music/index!save " method="post" class="MusicSearch" style="padding-bottom:20px;">
							<p class="m_l l"><span class="font13 vd_color9" style="width:70px; float:left;text-align:right;">曲目:</span><input type="text" name="name" id="music_name" class="t" style="margin-left:20px; display:inline; height:20px; width:200px;"/><div class="clear"></div></p>
							<p class="m_l l"><span class="font13 vd_color9" style="width:70px; float:left;text-align:right;">歌手:</span><input type="text" name="singer" id="music_singer" class="t" style="margin-left:20px; display:inline; height:20px; width:200px;"/><div class="clear"></div></p>
							<p class="m_l l"><span class="font13 vd_color9" style="width:70px; float:left;text-align:right;">链接地址:</span><textarea name="url" id="music_url" class="t" style="margin-left:20px; display:inline; width:400px;"></textarea><div class="clear"></div></p>
							<p class="m_l l">
								<span class="font13 vd_color9" style="width:70px; float:left;text-align:right;">
									曲目链接:
								</span>
								<input id="upload_1"  name="upload" type="file" value="" onchange="return mp3FileUpload(this,'music_url');" style="margin-left:20px; display:inline; height:20px; width:200px;"/>
								<div class="clear"></div>
							</p>
							<p class="vd_clear vd_center" style="padding-left:90px;">
								<input type="hidden" name="id" id="music_id" value=""/>
								<input type="button" value="试听" class="n1" onclick="testPlay()" style="margin-right:15px;"/>
								<input type="button" value="确定引用"  class="n1" onclick="saveMusic()" style="margin-right:15px;"/>
								<input type="button" value="取消"  class="n1" onclick="resetForm()" style="margin-right:15px;"/>
							</p>
						</form>
                    </div>
					<#-- 音乐播放器-->
					<div class="m_list" id="player" style="display:none">
						<object type="application/x-shockwave-flash" data="${statics}/plugins/dewplayer/dewplayer.swf" width="200" height="20" id="dewplayer" name="dewplayer" >
							<param name="movie" value="dewplayer.swf" />
							<param name="flashvars" value="mp3=${statics}/plugins/dewplayer/mp3/theDown.mp3&amp;autostart=1&amp;autoreplay=1&amp;showtime=1" id="flashvarsId"/>
							<param name="wmode" value="transparent" />
						</object>
					</div>
                    <div class="MusicGroup">
                        <ul class="MusicList half" style="width:98%;">
                        	<li class="MusicTop">自定义歌曲列表</li>
                        	<#if musicPage?exists>
                        		<#list musicPage.result as music>
		                            <li onmouseover="this.className='check'" onmouseout="this.className=''">
		                            	<div class="MusicCheck"><input name="" type="checkbox" value="" />1.</div>
		                                <div class="MusicTit"><a style="cursor:pointer;"  onClick="playMp3('${music.url!}')">${(music.name)!}</a></span></div>
		                                <div class="person">${(music.singer)!}</div>
		                                <div class="MusicHide">
		                                	<span><a style="cursor:pointer;"  onClick="playMp3('${music.url!}')" title="试听${(music.name)!}">试听</a></span>
		                                </div>
		                            </li>
                           		</#list>
                           	</#if>
                        </ul>
                       
                    </div>
                  </div>
            	</div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
 <script type="text/javascript" src="${statics}/plugins/fileupload/MEYMEY.mp3upload.js" language="javascript"></script>   
<script>
	function saveMusic(){
		var url=document.getElementById('music_url').value;
		var name=document.getElementById('music_name').value;
		if(url==null||url==""){
			alert("链接地址不能为空");
			return;
		}
		if(name==null||name==""){
			alert("曲目不能为空");
			return;
		}
		document.getElementById('saveForm').submit();
	}
	
	function testPlay(){
		var url=document.getElementById('music_url').value;
		if(url==null||url==""){
			alert("链接地址不能为空");
			return;
		}
		playMp3(url);
	}

	function resetForm(){
		document.getElementById('music_name').value="";
		document.getElementById('music_url').value="";
		document.getElementById('music_id').value="";
		document.getElementById('title').innerHTML="添加音乐";
	}
	function playMp3(url){
		document.getElementById('player').style.display="";
		document.getElementById('flashvarsId').value="mp3="+url+"&amp;autostart=1&amp;autoreplay=1&amp;showtime=1";
		document.getElementById('player').innerHTML=document.getElementById('player').innerHTML;
	}
	function editMusic(id,name,url){
		document.getElementById('music_name').value=name;
		document.getElementById('music_url').value=url;
		document.getElementById('music_id').value=id;
		document.getElementById('title').innerHTML="编辑音乐";
	}
	function del(o_id){
		if(window.confirm("确认删除该音乐引用吗?")){
			window.location.href="${base}/user/music/index!delete?id="+o_id;
		}
	}
</script>
</@user.user_html> 


